#ifndef SELFCHANGEDEVENT_H_
#define SELFCHANGEDEVENT_H_

#include <wx/event.h>
#include "../Buddy.h"

namespace Impp
{

enum SelfChangedEventType{
	SELF_CHANGED_SCREENNAME,
	SELF_CHANGED_CUSTOMNAME
};

class SelfChangedEvent : public wxNotifyEvent
{
private:
	Buddy* self;
	SelfChangedEventType changeType;
	wxString oldName;
	wxString newName;

public:
	SelfChangedEvent(Buddy* self, SelfChangedEventType changeType, wxEventType eventType = wxEVT_NULL, int id = 0);
	virtual ~SelfChangedEvent();

	virtual wxEvent* Clone()const;
	Buddy* getSelf();
	wxString getOldCustomName();
	wxString getNewCustomName();
	wxString getOldScreenName();
	wxString getNewScreenName();
	SelfChangedEventType getChangeType();

private:
	friend class Impp;
	void setOldCustomName(const wxString & oldCustomName);
	void setNewCustomName(const wxString & newCustomName);
	void setOldScreenName(const wxString & oldScreenName);
	void setNewScreenName(const wxString & newScreenName);
};

typedef void(wxEvtHandler::*SelfChangedEventFunction)(SelfChangedEvent&);

BEGIN_DECLARE_EVENT_TYPES()
  DECLARE_EVENT_TYPE(EVT_SELF_CHANGED, -1)
END_DECLARE_EVENT_TYPES()

#define EVT_SELF_CHANGED_MACRO(id, fn) DECLARE_EVENT_TABLE_ENTRY(               \
		EVT_SELF_CHANGED, id, -1, (wxObjectEventFunction)               \
        (wxEventFunction)(SelfChangedEventFunction) & fn,                             \
        (wxObject*) NULL),

#define SelfChangedEventHandler(func)                                                 \
        (wxObjectEventFunction)                                                \
        (wxEventFunction)wxStaticCastEvent(SelfChangedEventFunction, &func)


}

#endif /*SELFCHANGEDEVENT_H_*/
